import { Application } from "egg";

export default (app: Application) => {
  const { STRING, DATE, CHAR, INTEGER } = app.Sequelize;
  const model = app.model.define(
    "User",
    {
      user_id: { type: CHAR(32), primaryKey: true },
      user_name: STRING(20),
      user_password: STRING(50),
      user_age: INTEGER,
      user_sex: CHAR(1),
      user_sign: STRING(50),
      user_new_num: INTEGER,
      created_at: DATE,
      updated_at: DATE
    },
    { tableName: "tb_user" }
  );
  return model;
};

export class User {
  user_id: string;
  user_name: string;
  user_password: string;
  user_age: number;
  user_sex: string;
  user_sign: string;
  user_new_num: number;
}
